﻿using System;
using System.Configuration;
using System.Data.SqlClient;

namespace Program04
{
    public class Program
    {
        static void Main(string[] args)
        {
            //添加一条记录到TBL_User中
            //删除TBL_User一条记录
            //更新

            var connString = ConfigurationManager.AppSettings["connStr"];

            using (SqlConnection conn = new SqlConnection(connString))
            {
                //创建一个命令对象
                using (SqlCommand cmd = new SqlCommand())
                {
                    //初始化连接
                    cmd.Connection = conn;
                    conn.Open();

                    //cmd.CommandText = "insert TBL_User values('20180310012','韦某某','1','123','2089622085@qq.com','18软件技术3班',null)";
                    //cmd.CommandText = "delete TBL_User where userid='20180310012'";
                    cmd.CommandText = "update TBL_User set class='2018软件三班'";

                    cmd.ExecuteNonQuery();
                    Console.WriteLine("执行成功！");
                }
            }
        }
    }
}
